import json
import requests
url='https://game.gtimg.cn/images/lol/act/img/js/heroList/hero_list.js'
headers={
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
}
response=requests.get(url=url,headers=headers)
html=response.text
herojson=json.loads(html)
herolist=herojson['hero']
print(f'当前版本共{len(herolist)}个英雄')
for index,hero in enumerate(herolist) :
    print(index+1,hero['name'])





# response.content.decode("utf-8")
# html=""

# with open('index.html','r',encoding='gb2312') as file:
#     html=file.read()
# soup=BeautifulSoup(html,'lxml')
# # ul=soup.find_all(id="jSearchHeroDiv")
# print(soup.li)

